import 'package:flutter/material.dart';

enum DialogType {
  success,
  warn,
  error
}
class CusDialog {
  static final Map textColor = {DialogType.success: Colors.green[400], DialogType.error: Colors.red[400], DialogType.warn: Colors.yellow[400]};
  static alert({@required BuildContext context, @required String content, DialogType type = DialogType.success}) {
    showDialog(
      context: context,
      builder: (context){
        return SimpleDialog(
          title: Text(content, style: TextStyle(fontSize: 15, color: textColor[type]), textAlign: TextAlign.center),
          titlePadding: EdgeInsets.all(12),
        );
      }
    );
  }
  static showError(BuildContext context, String error) {
    CusDialog.alert(context:context, content: error, type: DialogType.error);
  }
  static showSuc(BuildContext context, String info) {
    CusDialog.alert(context:context, content: info, type: DialogType.success);
  }
}